home *** CD-ROM | disk | FTP | other *** search
- Path: ehsn25.cen.uiuc.edu!jroberts
- From: jroberts@ehsn25.cen.uiuc.edu (robertson jason victor )
- Newsgroups: comp.windows.x.motif,comp.lang.c++
- Subject: Re: MOTIF Callbacks, C++ Member Functions - SOLVED
- Date: 6 Feb 1996 06:41:30 GMT
- Organization: University of Illinois
- Distribution: inet
- Message-ID: <4f6t6q$7k@vixen.cso.uiuc.edu>
- References: <4f6oau$c4m@knot.queensu.ca>
- Reply-To: jroberts@uiuc.edu (Jason Robertson)
- NNTP-Posting-Host: ehsn25.cen.uiuc.edu
-
- In article <4f6oau$c4m@knot.queensu.ca> Wintermute <3mal5@qlink.queensu.ca> writes:
- >In case anyone's curious, I have implemented the suggestion I received
- >and it works beautifully. The problem was wrapping C++ classes around
- >Motif widgets and wanting to use class member functions as callbacks:
- >the implicit 'this' parameter of course made this impossible.
- >
- >The solution was to declare a static member function which is used as a
- >callback. Since it is static, there is no 'this' pointer, and it works
- >fine. To access the particular class instance, pass the 'this' pointer
- >as client data when installing the callback, and it will be available
- >when the static member function is called back. (I use it to call
- >another member function, but it could be used directly.)
- >
-
- I don't know if this was recommended earlier, but you might want to check out
- 'Object Oriented Programming with C++ and OSF/Motif' by Douglas A. Young.
-
- He goes over this method, and a few others (friend functions come to mind).
- It's a pretty good book.
-